/**
 * 
 */
package tests.board.pieces;

import junit.framework.TestCase;

import org.junit.Test;

import root.board.moviment.Moviment;
import root.board.pieces.Horse;

/**
 * @author Calebe
 * 
 */
public class HorseTest extends TestCase {

	private final Horse horseQuadrantTest = new Horse();

	@Test
	public void testX0Y0() {
		assertEquals(2, values(0, 0));
	}

	@Test
	public void testX0Y3() {
		assertEquals(4, values(0, 3));
	}

	@Test
	public void testX0Y4() {
		assertEquals(4, values(0, 4));
	}

	@Test
	public void testX0Y7() {
		assertEquals(2, values(0, 7));
	}

	@Test
	public void testX1Y1() {
		assertEquals(4, values(1, 1));
	}

	@Test
	public void testX1Y3() {
		assertEquals(6, values(1, 3));
	}

	@Test
	public void testX1Y4() {
		assertEquals(6, values(1, 4));
	}

	@Test
	public void testX1Y6() {
		assertEquals(4, values(1, 6));
	}

	@Test
	public void testX2Y2() {
		assertEquals(8, values(2, 2));
	}

	@Test
	public void testX2Y3() {
		assertEquals(8, values(2, 3));
	}

	@Test
	public void testX2Y4() {
		assertEquals(8, values(2, 4));
	}

	@Test
	public void testX2Y5() {
		assertEquals(6, values(1, 5));
	}

	@Test
	public void testX3Y0() {
		assertEquals(4, values(3, 0));
	}

	@Test
	public void testX3Y1() {
		assertEquals(6, values(3, 1));
	}

	@Test
	public void testX3Y2() {
		assertEquals(8, values(3, 2));
	}

	@Test
	public void testX3Y3() {
		assertEquals(8, values(3, 3));
	}

	@Test
	public void testX3Y4() {
		assertEquals(8, values(3, 4));
	}

	@Test
	public void testX3Y5() {
		assertEquals(8, values(3, 5));
	}

	@Test
	public void testX3Y6() {
		assertEquals(6, values(3, 6));
	}

	@Test
	public void testX3Y7() {
		assertEquals(4, values(3, 7));
	}

	@Test
	public void testX4Y0() {
		assertEquals(4, values(4, 0));
	}

	@Test
	public void testX4Y1() {
		assertEquals(values(4, 1), 6);
	}

	@Test
	public void testX4Y2() {
		assertEquals(values(4, 2), 8);
	}

	/**
	 * Quad1 test start on x = 4 and y = 3.
	 */
	@Test
	public void testX4Y3() {
		assertEquals(8, values(4, 3));
	}

	@Test
	public void testX5Y2() {
		assertEquals(8, values(5, 2));
	}

	@Test
	public void testX5Y3() {
		assertEquals(8, values(5, 3));
	}

	@Test
	public void testX6Y1() {
		assertEquals(4, values(6, 1));
	}

	@Test
	public void testX6Y3() {
		assertEquals(6, values(6, 3));
	}

	@Test
	public void testX7Y0() {
		assertEquals(2, values(7, 0));
	}

	@Test
	public void testX7Y3() {
		assertEquals(4, values(7, 3));
	}

	@Test
	public void testX7Y7() {
		assertEquals(2, values(7, 7));
	}

	private int values(int x, int y) {
		Moviment moviments[] = horseQuadrantTest.moviments(x, y);
		int count = 0;
		for (Moviment moviment : moviments) {
			if (moviment != null)
				count++;
		}
		return count;
	}
}
